package br.com.conjuntos.exercicios;

class E{
	int a;
	String b;
	public E(int a, String b){
		this.a = a;
		this.b = b;
	}
	public boolean equals(Object o){
		if((o instanceof E) && (((E)o).a==this.a))
			return true;
		return false;
	}
	public int hashCode(){
		return a;
	}
}
public class Programa3 {
	public static void main(String[] args) {
		E x = new E(10, "ABC");
		E y = new E(12,"BNC");
		E z = new E(10,"CBD");
		System.out.println(x.equals(y));//false
		System.out.println(x.equals(z));//true
		System.out.println(y.equals(z));//false
		System.out.println(x.hashCode()==y.hashCode());//false
		System.out.println(x.hashCode()==z.hashCode());//true
		System.out.println(y.hashCode()==z.hashCode());//false
	}
}
